<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
	
	<xsl:template match="/tests">
	  <html>
				<head>				  
					<title>Test-Result</title>
					<style type="text/css">
body {
 background-color: white;
 color: black;
 font-size: 12pt;
 font-family: sans-serif;
 }
.message {
  border: 3px dotted gray;
  padding: 3px;
  margin-bottom: 5px;
  }					
 .message-name {
  font-weight: bold;
  font-style: italic;
  }
 .message-text {
  }
.test {
  border: 3px solid gray;
  margin-bottom: 5px;
  }					
 .test-name {
  font-weight: bold;
  font-style: italic;
  }
 .test-result {
  padding-left: 10;
  }
.success {
  border: 3px solid green;
  }
.failure {
  border: 3px solid red;
  }
.warning {
  border: 3px solid yellow;
  }
pre { margin: 0 }
					</style>
				</head>
				<body>
				 <xsl:apply-templates/>
				</body>
			</html>
	</xsl:template>
	
	<xsl:template match="message">
	  <div class="message">
	   <div class="message-name"><xsl:value-of select="@name"/></div>
	   <div class="message-text"><pre><xsl:value-of select="."/></pre></div>
	  </div>
	</xsl:template>
	
	<xsl:template match="test">
	 <div class="test">
	  <div class="test-name"><xsl:value-of select="@name"/></div>
	  <xsl:choose>
				<xsl:when test="string-length(output/text()) = 0">
				 <div class="test-result success">Success</div>
				</xsl:when>
    			<xsl:otherwise>
    			  <div>
    			    <xsl:attribute name="class">test-result <xsl:choose>
												<xsl:when test="@type='warning'">warning</xsl:when>
												<xsl:otherwise>failure</xsl:otherwise>
											</xsl:choose></xsl:attribute>
    			    <pre><xsl:value-of select="output/text()"/></pre></div>
				</xsl:otherwise>
			</xsl:choose>
	 </div>
	</xsl:template>
</xsl:stylesheet>
